package com.verify.repository;

import com.baomidou.mybatisplus.extension.service.IService;
import com.verify.data.domain.ExcelUnit;
import com.verify.data.domain.SecondaryUnit;
import com.verify.mapper.ExcelUnitMapper;
import com.verify.mapper.SecondaryUnitMapper;
import com.verify.repository.base.BaseRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ExcelUnitRepository extends BaseRepository<ExcelUnitMapper, ExcelUnit>
        implements IService<ExcelUnit> {
    public ExcelUnit getByCodeAndNoName(String orgCode, String orgName) {
        return getOne(baseQuery().eq(ExcelUnit::getCode, orgCode).ne(ExcelUnit::getOrgName, orgName));
    }

    public List<ExcelUnit> listByInCode(List<String> codes) {
        return list(baseQuery().in(ExcelUnit::getCode, codes));
    }

    public ExcelUnit getByCode(String code) {
        return getOne(baseQuery().eq(ExcelUnit::getCode, code));
    }
}
